/* 
 * File:   UnitOfWork.h
 * Author: maximiliano
 *
 * Created on March 26, 2013, 5:42 PM
 */

#ifndef UNITOFWORK_H
#define	UNITOFWORK_H

#include <ostream>
#include <cstring>
#include "Mangle.h"
#include "Lista.h"

using namespace std;
using namespace TP::Colecciones;
using namespace TP3::Mangling;

namespace TP3 { namespace Working {

class UnitOfWork {
public:
    
    UnitOfWork(ostream* outPut);
    
    virtual ~UnitOfWork();
    
    string undo();
    
    string getCurrentState ();
    
    string& apply (string& operating);
    
    Mangle* addMangle (Mangle* mangle);
    
    

private:
    Lista _operationStates;
    Lista _mangles;
    ostream* _outPut;
    
    string& initStateMonitor (string& operating);
    
    string& setNewState (string& operating);
    
    void deleteStates();
    
    void deleteMangles();
    
    bool hasChanged(string& operating);
    
};

}}


#endif	/* UNITOFWORK_H */

